home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Mac Game Programming Gurus / TricksOfTheMacGameProgrammingGurus.iso / More Source / C⁄C++ / Tetris Light 1.0 / source / tetris.h < prev    next >
Text File  |  1993-08-02  |  2KB  |  79 lines

  1. /**********************************************************************\
  2.  
  3. File:        tetris.h
  4.  
  5. Purpose:    Header file for the tetris program module.
  6.             
  7.  
  8. ``Tetris Light'' - a simple implementation of a Tetris game.
  9. Copyright (C) 1993 Hoylen Sue
  10.  
  11. This program is free software; you can redistribute it and/or modify
  12. it under the terms of the GNU General Public License as published by
  13. the Free Software Foundation; either version 2 of the License, or
  14. (at your option) any later version.
  15.  
  16. This program is distributed in the hope that it will be useful,
  17. but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  19. GNU General Public License for more details.
  20.  
  21. You should have received a copy of the GNU General Public License
  22. along with this program; see the file COPYING.  If not, write to the
  23. Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  24.  
  25. \**********************************************************************/
  26.  
  27. #ifndef tetris_H
  28. #define tetris_H
  29.  
  30. /*--------------------------------------------------------------------*/
  31.  
  32. #define NUMBER_ROWS    18
  33. #define NUMBER_COLS    10
  34.  
  35. #define MAX_BLOCK_SIZE        4
  36.  
  37. #define NUMBER_BLOCK_TYPES    7
  38.  
  39. typedef enum {
  40.     move_left,
  41.     move_right,
  42.     move_down,
  43.     move_drop,
  44.     move_anticlockwise
  45. } Move_direction;
  46.  
  47. /*--------------------------------------------------------------------*/
  48.  
  49. /* This structure is used when saving and restoring a game.  It stores
  50.    all the information needed to save and restore the game. */
  51.  
  52. struct Tetris_state {
  53.     unsigned short score;
  54.     
  55.     int left;
  56.     int top;
  57.     int block;
  58.     int orientation;
  59.  
  60.     int next_block;
  61.     int next_orientation;
  62. };
  63.  
  64. /*--------------------------------------------------------------------*/
  65.  
  66. extern void tetris_start(struct Tetris_state *state);
  67.  
  68. extern Boolean tetris_try_move(Move_direction direction);
  69. extern void tetris_periodic(void);
  70.  
  71. extern void tetris_pause(Boolean paused);
  72.  
  73. extern unsigned short tetris_score(void);
  74. extern void tetris_state_get(struct Tetris_state *state);
  75.  
  76. /*--------------------------------------------------------------------*/
  77.  
  78. #endif
  79.